package com.willy.example;

import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
import org.junit.Test;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import static org.junit.Assert.assertEquals;

public class ExampleOhosTest {
    @Test
    public void testBundleName() {
        final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName();
        assertEquals("com.willy.example", actualBundleName);
    }

    @Test
    public void getNumStars() {
        try {
            Class fileListItem = Class.forName("com.willy.ratingbar.SimpleRatingBar");
            Method log = fileListItem.getMethod("getNumStars");
            Object obj = fileListItem.getConstructor().newInstance();
            log.invoke(obj);
        } catch (ClassNotFoundException ep) {
            ep.printStackTrace();
        } catch (NoSuchMethodException ep) {
            ep.printStackTrace();
        } catch (IllegalAccessException ep) {
            ep.printStackTrace();
        } catch (InstantiationException ep) {
            ep.printStackTrace();
        } catch (InvocationTargetException ep) {
            ep.printStackTrace();
        }
    }

    @Test
    public void getRating() {
        try {
            Class fileListItem = Class.forName("com.willy.ratingbar.SimpleRatingBar");
            Method log = fileListItem.getMethod("getRating");
            Object obj = fileListItem.getConstructor().newInstance();
            log.invoke(obj);
        } catch (ClassNotFoundException ep) {
            ep.printStackTrace();
        } catch (NoSuchMethodException ep) {
            ep.printStackTrace();
        } catch (IllegalAccessException ep) {
            ep.printStackTrace();
        } catch (InstantiationException ep) {
            ep.printStackTrace();
        } catch (InvocationTargetException ep) {
            ep.printStackTrace();
        }
    }

    @Test
    public void getStarWidth() {
        try {
            Class fileListItem = Class.forName("com.willy.ratingbar.SimpleRatingBar");
            Method log = fileListItem.getMethod("getStarWidth");
            Object obj = fileListItem.getConstructor().newInstance();
            log.invoke(obj);
        } catch (ClassNotFoundException ep) {
            ep.printStackTrace();
        } catch (NoSuchMethodException ep) {
            ep.printStackTrace();
        } catch (IllegalAccessException ep) {
            ep.printStackTrace();
        } catch (InstantiationException ep) {
            ep.printStackTrace();
        } catch (InvocationTargetException ep) {
            ep.printStackTrace();
        }
    }

    @Test
    public void getStarHeight() {
        try {
            Class fileListItem = Class.forName("com.willy.ratingbar.SimpleRatingBar");
            Method log = fileListItem.getMethod("getStarHeight");
            Object obj = fileListItem.getConstructor().newInstance();
            log.invoke(obj);
        } catch (ClassNotFoundException ep) {
            ep.printStackTrace();
        } catch (NoSuchMethodException ep) {
            ep.printStackTrace();
        } catch (IllegalAccessException ep) {
            ep.printStackTrace();
        } catch (InstantiationException ep) {
            ep.printStackTrace();
        } catch (InvocationTargetException ep) {
            ep.printStackTrace();
        }
    }

    @Test
    public void getStarPadding() {
        try {
            Class fileListItem = Class.forName("com.willy.ratingbar.SimpleRatingBar");
            Method log = fileListItem.getMethod("getStarPadding");
            Object obj = fileListItem.getConstructor().newInstance();
            log.invoke(obj);
        } catch (ClassNotFoundException ep) {
            ep.printStackTrace();
        } catch (NoSuchMethodException ep) {
            ep.printStackTrace();
        } catch (IllegalAccessException ep) {
            ep.printStackTrace();
        } catch (InstantiationException ep) {
            ep.printStackTrace();
        } catch (InvocationTargetException ep) {
            ep.printStackTrace();
        }
    }

    @Test
    public void getStepSize() {
        try {
            Class fileListItem = Class.forName("com.willy.ratingbar.SimpleRatingBar");
            Method log = fileListItem.getMethod("getStepSize");
            Object obj = fileListItem.getConstructor().newInstance();
            log.invoke(obj);
        } catch (ClassNotFoundException ep) {
            ep.printStackTrace();
        } catch (NoSuchMethodException ep) {
            ep.printStackTrace();
        } catch (IllegalAccessException ep) {
            ep.printStackTrace();
        } catch (InstantiationException ep) {
            ep.printStackTrace();
        } catch (InvocationTargetException ep) {
            ep.printStackTrace();
        }
    }

    @Test
    public void getDecimalFormat() {
        try {
            Class fileListItem = Class.forName("com.willy.ratingbar.RatingBarUtils");
            Method log = fileListItem.getMethod("getDecimalFormat");
            Object obj = fileListItem.getConstructor().newInstance();
            log.invoke(obj);
        } catch (ClassNotFoundException ep) {
            ep.printStackTrace();
        } catch (NoSuchMethodException ep) {
            ep.printStackTrace();
        } catch (IllegalAccessException ep) {
            ep.printStackTrace();
        } catch (InstantiationException ep) {
            ep.printStackTrace();
        } catch (InvocationTargetException ep) {
            ep.printStackTrace();
        }
    }

    @Test
    public void init() {
        try {
            Class fileListItem = Class.forName("com.willy.ratingbar.PartialView");
            Method log = fileListItem.getMethod("init");
            Object obj = fileListItem.getConstructor().newInstance();
            log.invoke(obj);
        } catch (ClassNotFoundException ep) {
            ep.printStackTrace();
        } catch (NoSuchMethodException ep) {
            ep.printStackTrace();
        } catch (IllegalAccessException ep) {
            ep.printStackTrace();
        } catch (InstantiationException ep) {
            ep.printStackTrace();
        } catch (InvocationTargetException ep) {
            ep.printStackTrace();
        }
    }

    @Test
    public void setFilled() {
        try {
            Class fileListItem = Class.forName("com.willy.ratingbar.PartialView");
            Method log = fileListItem.getMethod("setFilled");
            Object obj = fileListItem.getConstructor().newInstance();
            log.invoke(obj);
        } catch (ClassNotFoundException ep) {
            ep.printStackTrace();
        } catch (NoSuchMethodException ep) {
            ep.printStackTrace();
        } catch (IllegalAccessException ep) {
            ep.printStackTrace();
        } catch (InstantiationException ep) {
            ep.printStackTrace();
        } catch (InvocationTargetException ep) {
            ep.printStackTrace();
        }
    }

    @Test
    public void setEmpty() {
        try {
            Class fileListItem = Class.forName("com.willy.ratingbar.PartialView");
            Method log = fileListItem.getMethod("setEmpty");
            Object obj = fileListItem.getConstructor().newInstance();
            log.invoke(obj);
        } catch (ClassNotFoundException ep) {
            ep.printStackTrace();
        } catch (NoSuchMethodException ep) {
            ep.printStackTrace();
        } catch (IllegalAccessException ep) {
            ep.printStackTrace();
        } catch (InstantiationException ep) {
            ep.printStackTrace();
        } catch (InvocationTargetException ep) {
            ep.printStackTrace();
        }
    }
}